import * as path from "path";
import { createVuePlugin } from "vite-plugin-vue2";
import { defineConfig } from "vite";

export default defineConfig({
  server: {
    port: "8989" // 启动窗口
  },
  resolve: {
    alias: {
      "@": path.resolve(__dirname, "./") // 配置别名
    }
  },
  plugins: [createVuePlugin()],
  build: {
    target: "es2015",
    rollupOptions: {
      external: ["element-ui", "vue"], // 第三方库不参与打包
    },
    lib: {
      entry: path.resolve(__dirname, "./components/index.js"), // 打包的入口
      name: "ulearning-sz-ui",
      fileName: "ulearning-sz-ui",
      formats: ["es", "umd"]
    }
  }
});
